import axios from "axios";

export const requset = axios.create({
  baseURL: "",
  timeout: 5000,
});

requset.interceptors.request.use(
  (config) => {
    config.data = JSON.stringify(config.data);
    config.headers = {
      "Content-Type": "application/json",
    };
    // 权限
    config.headers["Authorization"] = localStorage.getItem("token");

    return config;
  },
  (err) => Promise.reject(err)
);

requset.interceptors.response.use(
  (response) => {
    return response;
  },
  (err) => Promise.reject(err)
);
